package jieke;

public class A {
    public static void main(String[] args) {
        // 测试普通员工
        try {
            putong p = new putong(1001, "小明", 50, 160);
            System.out.println(p.gongzitiao());
            System.out.println("-------------------");
        } catch (IllegalArgumentException e) {
            System.out.println("普通员工薪资计算异常：" + e.getMessage());
        }
        guanli g = new guanli(2001, "小李", 15000, 6000);
        System.out.println(g.gongzitiao());
        System.out.println("-------------------");

        // 测试异常场景（工作时长为负）
        try {
            putong pErr = new putong(1002, "小王", 50, -10);
            System.out.println(pErr.gongzitiao());
        } catch (IllegalArgumentException e) {
            System.out.println("普通员工薪资计算异常：" + e.getMessage());
        }

        // 多态性演示
        System.out.println("\n=== 多态性演示 ===");
        people[] employees = {
                new putong(1003, "张三", 45, 150),
                new guanli(2002, "李四", 12000, 3000)
        };

        for (people emp : employees) {
            System.out.println(emp.gongzitiao());
            System.out.println("----------------");
        }
    }
}
